<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>门店提现</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, maximum-scale=1, user-scalable=no,viewport-fit=cover">
    <link href="css/common.css" rel="stylesheet">
    <style>
        #moneyInput{
            font-size: 16px;
            line-height: 32px;
            padding-left: 10px;
            width: 80%;
            border: 0px;
        }
    </style>
</head>
<body>
<div class="head-nav">
    <div class="nav-left" onclick="javascript:history.back(-1)"><img src="img/gua/u18.png"></div>
    <div class="nav-title">门店提现</div>
</div>
<div class="main">
    <div class="notice-content">
        <div>您正在 <b id="shopName">京城大厦1号店</b> 提现</div>
        <div class="small">请告知店员您要提现的金额，店员确认后再进行操作</div>
    </div>

    <div style="height: 8vw"></div>
    <div class="height-40">
        <div class="form-label wd-30 in-block">提现金额</div>
        <div class="in-block"><input type="number" id="moneyInput" value=""></div>
    </div>
    <div style="height: 10vw"></div>

    <div class="btn-line" id="drawBtn">确定提现</div>

</div>


<script src="js/jquery-1.8.0.min.js"></script>
<script src="js/common.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="https://cdn.bootcss.com/layer/3.0.1/layer.min.js"></script>

<script type="application/javascript">
    var shopId;
    $(function () {
        shopId = Common.queryGetParam("shopId");
        getopenid();
    });
    $("#drawBtn").on("click",function () {
        if(!shopId){
            layer.alert("找不到商户id，请联系管理员");
            return;
        }
        var money = $("#moneyInput").val();
        var regx = /^[1-9]\d*$/;
        if(!regx.test(money)){
            layer.msg("请输入整数金额");
            return;
        }
        money = parseInt(money);

        var paramStr = {};
        paramStr.shopId = shopId;
        paramStr.money = money;
        paramStr.wxOpenId = openid;
        var params = {};
        params.paramStr = JSON.stringify(paramStr);


    });

    var openid;
    function getopenid() {
        openid = window.localStorage.getItem("openid");
        if(openid == null || openid == undefined || openid == '') {
            getCode();
        }
    }
    function getCode() {
        var code = Common.queryGetParam('code');
        if(code == null || code == undefined || code == '') {
            location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx95bdc635798fcfe4&redirect_uri="+window.location.href+"&response_type=code&scope=snsapi_base#wechat_redirect";
            return;
        }
        var paramStr = {};
        paramStr.code = code;
        var params = {};
        params.paramStr = JSON.stringify(paramStr);
        Common.ajaxWithParam("/fenful/api/v1/common/getWxUserOpenId", params, function(data) {
            openid = data.openid;
            window.localStorage.setItem("openid", data.openid);
        },false);
    }
</script>

</body>
</html>